#include "connecttodatabase.h"

ConnectToDatabase::ConnectToDatabase()
{
}

bool ConnectToDatabase::doConnect(QString driver, QString hostname, QString databasename, QString username, QString password)
{
    m_db = QSqlDatabase::addDatabase(driver);
    m_db.setHostName(hostname);
    m_db.setDatabaseName(databasename);
    m_db.setUserName(username);
    m_db.setPassword(password);
    return m_db.open();
}


QSqlDatabase ConnectToDatabase::con() const
{
    return m_db;
}

void ConnectToDatabase::close(void) {
    m_db.close();
}

bool  ConnectToDatabase::isOpen(void) const {
    return m_db.isOpen();
}
